/* Layout */
import MainLayout from 'layouts/main-layout.vue'

/**
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu(default is false)
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if set noredirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)（必须跟'page.vue'中的name完全一致，包括大小写，才能正确keep-alive）
 * meta : {
    （不支持）roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    captionxx: '副标题'             可选
    icon: 'name|img:path|base64' the icon show in the sidebar
    iconColor: 'text-grey'      不填默认primary
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view (default is false)
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

const routes = [
  {
    path: '/',
    component: MainLayout,
    redirect: '/',
    meta: {
      requireAuth: true, // 判断是否需要登录
    },
    children: [
      {
        path: '',
        name: 'Index',
        component: () => import('pages/Index.vue'),
        meta: { title: '首页', icon: 'home', affix: true, noCache: true }
      }
    ]
  },
  {
    path: '/user',
    component: () => import('layouts/login-layout.vue'),
    meta: { title: '用户', icon: 'account_circle' },
    children: [
      {
        path: 'login',
        name: 'user-login',
        component: () => import('pages/user/Login.vue'),
        meta: { title: '登录', icon: 'login', noCache: true }
      },
      {
        path: 'register',
        name: 'user-register',
        component: () => import('pages/user/Register.vue'),
        meta: { title: '注册', icon: 'add', noCache: true }
      }
    ]
  },
  {
    path: '/crud',
    component: MainLayout,
    name: '管理',
    redirect: 'noredirect',
    alwaysShow: true,
    meta: { title: '农产品管理', icon: 'settings_suggest'},
    children: [
      {
        path: 'goodTable',
        name: 'goodTable',
        component: () => import('pages/tables/goodTable'),
        meta: { title: '商品管理', icon: 'medical_services' }
      },
      {
        path: 'suppierTable',
        name: 'suppierTable',
        component: () => import('pages/tables/suppierTable'),
        meta: { title: '供应商管理', icon: 'support' }
      },
      {
        path: 'agentsTable',
        name: 'agentsTable',
        component: () => import('pages/tables/agentsTable'),
        meta: { title: '代理商管理', icon: 'store_mall_directory' }
      },
      {
        path: 'orderTable',
        name: 'orderTable',
        component: () => import('pages/tables/orderTable'),
        meta: { title: '订单管理', icon: 'list_alt' }
      },
      {
        path: 'adviceCard',
        name: 'adviceCard',
        component: () => import('pages/tables/adviceCard'),
        meta: { title: '订单评价', icon: 'event_available' }
      }
    ]
  },
  {
    path: '/funny',
    component: MainLayout,
    name: 'funny',
    redirect: 'noredirect',
    alwaysShow: true,
    meta: { title: '有趣的东西', icon: 'sentiment_very_satisfied'},
    children: [
      {
        path: 'video',
        name: 'video',
        component: () => import('pages/funny/video'),
        meta: { title: 'vip视频解析', icon: 'auto_fix_high' }
      }
    ]
  },
  {
    path: '/page',
    component: MainLayout,
    name: 'Page',
    alwaysShow: true,
    redirect: 'noredirect',
    meta: { title: '其他页面', icon: 'web' },
    children: [
      {
        path: 'plant',
        name: 'plant',
        component: () => import('pages/other/plant'),
        meta: { title: '果蔬识别', icon: 'wallpaper' }
      },
      {
        path: 'big',
        name: 'big',
        component: () => import('pages/other/bigData'),
        meta: { title: '预警监测', icon: 'voicemail' }
      },
      {
        path: 'map',
        name: 'map',
        component: () => import('pages/other/map'),
        meta: { title: '地图', icon: 'pin_drop' }
      }
    ]
  },
  {
    path: '/401',
    component: MainLayout,
    hidden: true,
    children: [
      { path: '', component: () => import('pages/Error401.vue') }
    ]
  },

  // Always leave this as last one,
  // but you can also remove it
  {
    path: '*',
    component: MainLayout,
    hidden: true,
    children: [
      { path: '', component: () => import('pages/Error404.vue') }
    ]
  }
]

export default routes
